RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} !^imgid= [NC]
RewriteRule ^(.*)$ wp-content/uploads/gdwpm_images/index.php?imgid=$1 [L,NC,QSA]